package com.shawn.server.service;

import com.shawn.dubbo.api.LocationApi;
import com.shawn.model.vo.ErrorResult;
import com.shawn.server.exception.BusinessException;
import com.shawn.server.interceptor.ThreadContext;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

@Service
public class MapService {

    @DubboReference
    private LocationApi locationApi;


    public void uploadMapInfo(Double longitude, Double latitude, String addressDescription) {
        Long userId = ThreadContext.getUserId();
       Boolean res =  locationApi.uploadMapInfo(userId,longitude,latitude,addressDescription);
       if (!res){
           throw new BusinessException(ErrorResult.mapLoadError());
       }
    }
}
